package com.practice.network;

import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class IpAddress {
	public static void run() {
		try {
			printAddress(InetAddress.getLocalHost());
			printAddress(Inet4Address.getLocalHost());
			printAddress(Inet6Address.getLocalHost());
		} catch (UnknownHostException ex){
			ex.printStackTrace();
		}
	}

	private static void printAddress(InetAddress address) {
			System.out.println(address.toString());
			System.out.println(address.getHostName());
			System.out.println(address.getHostAddress());
	}
}
